<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<script type="text/javascript" src="../../jquery/jquery-1.8.3.js"></script>
<script>
	var parentObj =window.parent;
	//var langurl = parentObj.langurl.value;
	var langurl = parentObj.document.getElementById("langurl").value;
	var mutiLangScript = "<script type='text/javascript' src='" + langurl + "'><\/script>";
	document.write(mutiLangScript);
	window.onload = function() {
		window.parent.iframeLoaded();
	}
</script>

</head>
<body>
	<div>
	<table>
		<tbody id="template_header_database">
			<tr bgcolor="#E6E6E6">
				<!-- 增加序号表头 -->
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="sequence">序号</th>
				<th style="display: none;"><input style="display: none;"></th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="operation">操作</th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="fieldname">字段名称</th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="fieldremark">字段备注</th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="fieldlength">字段长度</th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="decimal">小数点</th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="defaultvalue">默认值</th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="fieldtype">字段类型</th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="pk">主键</th>
				<th style="display: none;"><input style="display: none;"></th>
				<th align="center" bgcolor="#EEEEEE" mutiLang_id="allowempty">允许空值</th>
			</tr>
		</tbody>
		<tbody id="add_column_table_template_database">
			<tr>
				<!-- 增加行序号<a>标签 -->
				<td style="width: 30px;" ><a name="rownumber[#rindex#]"></a></td>
				<td style="display: none;"><input style="display: none;" name="columns[#index#].id"
					value=""></td>
				<td align="left"><input style="width: 30px;" type="checkbox"
					name="ck" /></td>
				<td align="left">
					<input style="width: 120px;" type="text" name="columns[#index#].fieldName" nullmsg="pleaseinputfilename"
					datatype="s1-30,/^[a-z\d_]+$/" errormsg="filenamecannotuppercase" class="fieldNameInput" />
					
					<input style="width: 120px;" type="hidden" name="columns[#index#].oldFieldName"  />
				</td>
				<td align="left">
					
					<input style="width: 120px;" type="text" name="columns[#index#].content" nullmsg="pleaseinputfilecomment" 
					datatype="s2-14" errormsg="fieldcommentfromtwotofourteen" class="contentInput" />
				</td>
				
				<td align="left">
					<input name="columns[#index#].length" nullmsg="pleaseinputfilelength" datatype="n1-4" errormsg="fieldlengthfromonetofour"
					maxlength="4" type="text" value="32" style="width: 60px;">
				</td>
				
				<td align="left">
					<input name="columns[#index#].pointLength" nullmsg="pleaseinputdicemallength" datatype="n1-2" errormsg="dicemallengthfromonetotwo"
					type="text" value="0" style="width: 60px;">
				</td>
				
				<td align="left">
					<input name="columns[#index#].fieldDefault" datatype="*1-20" errormsg="defaultvaluelessthantwenty" ignore="ignore"
					type="text" value="" style="width: 60px;">
				</td>
				
				<td align="left">
					<select name="columns[#index#].type">
						<option value="string">String</option>
						<option value="int">Integer</option>
						<option value="double">Double</option>
						<option value="Date">Date</option>
						<option value="BigDecimal">BigDecimal</option>
						<option value="Text">Text</option>
						<option value="Blob">Blob</option>
					</select>
				</td>
				
				<td align="left">
					<input type="checkbox" style="width: 30px;" name="columns[#index#].isKey">
				</td>
				
				<td align="left" style="display: none;">
					<input name="columns[#index#].orderNum" maxlength="2" nullmsg="pleaseinputfieldsquence" datatype="n1-2"
					errormsg="fieldsquencefromonetotwo" type="hidden" value="0"
					style="display: none;">
				</td>
				
				<td align="left">
					<input type="checkbox" style="width: 50px;" name="columns[#index#].isNull" checked="checked">
				</td>
			</tr>
		</tbody>
	</table>
</div>
</body>
</html>

<script>
$(document).ready(function(){
	$("[mutiLang_id]").each(function() {
		this.innerText = eval(this.attributes["mutiLang_id"].value);
	});
	

	$("input:text").each(function(){
		var nullmsg = $(this).attr("nullmsg");
		var errormsg = $(this).attr("errormsg");
		
		if (typeof(nullmsg) != "undefined")
		{
			this.attributes["nullmsg"].value = eval(nullmsg); 
		}
		
		if (typeof(errormsg) != "undefined")
		{
			this.attributes["errormsg"].value = eval(errormsg); 
		}
	});
	/*update-start--Author:gengjiajia  Date:20160804 for：如果表类型是“配置表”，则online表单配置的第一个tab\索引tab\外键都不允许修改，禁掉。*/
	var tableType = parentObj.document.getElementById("tableType").value;
	if(tableType == '1'){
		$("#add_column_table_template_database").find("input[name*='columns']").each(function(){
			  var nameval = ($(this).attr("name"));
			  $("input[name='"+nameval+"']").attr("readonly","readonly");
		});
		$("select[name*='columns']").attr("disabled",true);
		$("input:checkbox").attr("disabled",true);
	}
	/*update-end--Author:gengjiajia  Date:20160804 for：如果表类型是“配置表”，则online表单配置的第一个tab\索引tab\外键都不允许修改，禁掉。*/
})
</script>